// Copyright (c) 2009 Mike Haight, Andy Kipp
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.

#pragma once

// Standard Windows Headers
#include <math.h>
#include <windows.h>

// Standard Template Library
#include <iostream>
#include <sstream>
#include <fstream>
#include <stdexcept>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

// Boost
#include <boost/filesystem.hpp>
#include <boost/format.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/python.hpp>
#include <boost/regex.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/thread.hpp>

// DirectX Headers
#ifdef _D3D10_1
    #include <d3d10_1.h>
    #include <d3d10.h>
    #include <d3dx10.h>
#else
#ifdef _D3D9
    #include <d3d9.h>
    #include <d3dx9.h>
#endif // _D3D9
#endif // _D3D10_1

// DirectInput Headers
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>

// #defines
#define SAFE_DELETE(_Pointer) do { if (NULL != _Pointer) { delete _Pointer; _Pointer = NULL; } } while (0, 0)
#define SAFE_RELEASE(_IUnknown) do { if (NULL != _IUnknown) { _IUnknown->Release(); _IUnknown = NULL; } } while (0, 0)
#define THROW_IF_FAILED(_Result, _Message) do { if (FAILED(_Result)) { throw std::exception(_Message); } } while (0, 0)
#define THROW_IF_NULL(_Variable, _Message) do { if (NULL == (_Variable)) { throw std::exception(_Message); } } while (0, 0)
#define THROW_IF_FALSE(_Variable, _Message) do { if (false == (_Variable)) { throw std::exception(_Message); } } while (0, 0)

#define DECLARE_PROPERTY_GET(_Name, _Type) _Type _Name(void) const;
#define DECLARE_PROPERTY_GET_SET(_Name, _Type) _Type _Name(void) const; void _Name(_Type value);

#define TICKS_PER_SECOND 30.0f
#define INVERSE_TICKS_PER_SECOND 1.0f/TICKS_PER_SECOND

// Global Includes
#include "Logger.h"
